package week4;

/**
 * Created by dell on 2017/3/14.
 */
public class Circle2 {
    private double radius = 1;
    private static int numberOfObject = 0;
    public Circle2() {
        numberOfObject ++;
    }

    public Circle2(double newRadius){
        radius = newRadius;
        numberOfObject ++;
    }

    public double getRadius(){
        return radius;
    }

    public void setRadius(double newRadius) {
        radius = (newRadius >= 0 ? newRadius : 0);
    }

    public static int getNumberOfObject(){
        return numberOfObject;
    }

    public double getArea(){
        return radius * radius * Math.PI;
    }
}
